package com.yifeng.repo.flink.data.transport.dto;

import com.google.common.base.Strings;

/**
 * DDL的类型
 * 修改字段：modify 删除字段：delete 增加字段：add
 * @author lijing
 * @since 2023-04-12
 *
 */
public enum DdlTypeEnums {

	MODIFY("modify", "修改字段"), 
	DROP("drop", "删除字段"), 
	ADD("add", "新增字段"),
	RENAME_COLUMN("rename_column", "修改列名"),
	RENAME_TABLE("rename_table", "修改表名"),
	COMMENT("comment", "备注");
	private final String type;
	private final String name;

	public String getType() {
		return type;
	}

	public static DdlTypeEnums parse(String type) {
		if (Strings.isNullOrEmpty(type)) {
			return null;
		}
		DdlTypeEnums[] coll = values();
		for (DdlTypeEnums item : coll) {
			if (item.getType().equals(type)) {
				return item;
			}
		}
		return null;
	}

	public String getName() {
		return name;
	}

	DdlTypeEnums(String type, String name) {
		this.type = type;
		this.name = name;
	}
}
